﻿/*----------------------------------------------------------------
           // Copyright (C) 2008 安华顺通(北京)科技有限公司
           // 版权所有。 
           //
           // 文件名：BaseEnum.cs
           // 文件功能描述：
           //
           // 
           // 创建标识：丁余良 2008 2008-10-23 12:58:09   建立文件
           //
           // 修改标识  //update1  at date...
           // 修改描述：
           //
           // 修改标识：//update2  at date...
           // 修改描述：
//----------------------------------------------------------------*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RuleCode.Common
{
    public class BaseEnum
    {
        public BaseEnum()
        { 

        }

        protected BaseEnumProperty baseEnumProperty;
        public virtual  BaseEnumProperty BaseEnumProperty
        {
            get { return this.baseEnumProperty;   }
            set { this.baseEnumProperty = value; }
        }
    }

    public class BaseEnumProperty
    {
        public BaseEnumProperty()
        {
            this.enumatorPropertyList = new List<EnumatorProperty>();
        }

        private string displayLength;
        public string DisplayLength
        {
            get { return this.displayLength;  }
            set { this.displayLength = value; }
        }

        private string style;
        public string Style
        {
            get { return this.style;  }
            set { this.style = value; }
        }

        private bool useEnumValue;
        public bool UseEnumValue
        {
            get { return this.useEnumValue;  }
            set { this.useEnumValue = value; }
        }

        private string name;
        public string Name
        {
            get { return this.name;  }
            set { this.name = value; }
        }
        private string label;
        public string Label
        {
            get { return this.label;  }
            set { this.label = value; }
        }

        private string id;
        public string ID
        {
            get { return this.id;  }
            set { this.id = value; }
        }

        private List<EnumatorProperty> enumatorPropertyList;
        public virtual  List<EnumatorProperty> EnumatorPropertyList
        {
            get { return this.enumatorPropertyList;  }
            set { this.enumatorPropertyList = value; }
        }
    }


   

    public struct EnumatorProperty
    {


        private int enumValue;
        public int EnumValue
        {
            get { return this.enumValue; }
            set { this.enumValue = value; }
        }

        private string name;
        public string Name
        {
            get { return this.name; }
            set { this.name = value; }
        }

        private string label;
        public string Label
        {
            get { return this.label; }
            set { this.label = value; }
        }

        private string id;
        public string ID
        {
            get { return this.id; }
            set { this.id = value; }
        }

        public string Text
        {
            get
            {
                if (this.label == "" || this.label == null)
                    return "";
                return SystemLanguage.Instance.GetLabel(this.label);
            }
        }

        public override string ToString()
        {
            return this.enumValue.ToString();
            //return base.ToString();
        }

        public static explicit operator Int32(EnumatorProperty x) { return x.EnumValue; }
    }

}
